<?php
require("../lib/standard.php");
Globals::database();
Globals::diavase("lib/selida.php");

Selida::head();
Selida::stylesheet('paraskinio/paraskinio');
Selida::javascript('common/prefadoros');
Selida::javascript('paraskinio/paraskinio');
Paraskinio::init();
Selida::body();
Paraskinio::paleta();
Selida::telos(FALSE);

class Paraskinio {
	private static $images;

	public static function init() {
		if (Globals::perastike("parentIconId")) {
			?>
			<script type="text/javascript">
			//<![CDATA[
			Paraskinio.parentIconId = '<?php print $_REQUEST["parentIconId"]; ?>';
			//]]>
			</script>
			<?php
		}

		self::$images = array();
		$files = scandir("../images/paraskinio");
		for ($i = count($files) - 1; $i >= 0; $i--) {
			$x = explode(".", $files[$i]);
			if (count($x) < 2) continue;

			switch ($x[count($x) - 1]) {
			case "jpg":
			case "png":
			case "gif":
				self::$images[] = $files[$i];
			}
		}
	}

	public static function paleta() {
		for ($i = count(self::$images) - 1; $i >= 0; $i--) {
			self::paleta_image(self::$images[$i]);
		}
	}

	private static function paleta_image($image) {
		?>
		<div class="paraskinio_container"><img class="paraskinio_digma" title="Επιλογή παρασκηνίου"
			src="../images/paraskinio/<?php print $image; ?>" onmouseout="Paraskinio.afesi(this);"
			onmouseover="Paraskinio.protasi(this, '<?php print $image; ?>');"
			onclick="Paraskinio.epilogi(this, '<?php print $image; ?>');" />
		</div>
		<?php
	}
}
?>
